/*------------------------------------------------------------------------------
 * Copyright 2012 NCR Corporation
 *------------------------------------------------------------------------------
 * All revision information is updated automatically from source code control
 * change records - please do not manually edit.
 *------------------------------------------------------------------------------
 *
 * $LastChangedRevision:: 2026                                     $
 * $LastChangedBy:: rb250096                                       $
 * $LastChangedDate:: 2012-04-07 18:34:30 -0400 (Sat, 07 Apr 2012) $
 */

package com.ncr.nep.dashboardcore.ui.client;

import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.cellview.client.CellList;

/**
 * Resource and style object for a {@link CellList} that inherits styles
 * from the application-wide theme.  The class applied to the list is
 * <code>ds-CellList</code>.
 *
 * @author rb250096
 * @version $Revision: 2026 $
 */
public class InheritedCellListResources implements CellList.Resources {

    /**
     * Style object defining style names for cell list.
     */
    class InheritedStyles implements CellList.Style {

        /**
         * Constant defining name of empty css class that defines nothing.
         */
        private static final String EMPTY_CLASS_NAME = "nop";

        /**
         * Constant defining class used for selected elements; the class will
         * be ancestor-based against a table element and tied to a
         * <code>tr</code> or <code>td</code> element so it won't conflict
         * with other styles found elsewhere.
         */
        private static final String SELECTED_CLASS = "selected";

        @Override
        public String cellListEvenItem() {
            return EMPTY_CLASS_NAME;
        }

        @Override
        public String cellListKeyboardSelectedItem() {
            return SELECTED_CLASS;
        }

        @Override
        public String cellListOddItem() {
            return "odd-row";
        }

        @Override
        public String cellListSelectedItem() {
            return SELECTED_CLASS;
        }

        @Override
        public String cellListWidget() {
            return "ds-CellList";
        }

        @Override
        public boolean ensureInjected() {
            return true;
        }

        @Override
        public String getText() {
            return EMPTY_CLASS_NAME;
        }

        @Override
        public String getName() {
            return EMPTY_CLASS_NAME;
        }
    }

    @Override
    public ImageResource cellListSelectedBackground() {
        return null;
    }

    @Override
    public CellList.Style cellListStyle() {
        return new InheritedStyles();
    }
}
